﻿var _jsonData_hz = [
        {
            "id": "3d66358b5c634e2dbf3d42b475f9a7d4",
            "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
            "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
            "queuingOrderNo": 102,
            "patientKey": "999999999001",
            "patientName": "多大的1",
            "registerId": "1",
            "registerTime": "20180523095610",
            "timeType": 0,
            "triageTime": "20180523095620",
            "queuingDate": "20180523000000",
            "delayTime": 0,
            "delayEditTime": null,
            "editor": "automatic",
            "editTime": "20180523095620",
            "isDeleted": 0,
            "sex": 1,
            "signOrderNo": 102,
            "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
            "remarks": null,
            "isNumRecall": 0,
            "isGreenChannel": 0,
            "treatStatus": 1,
            "treatmentStage": 1,
            "waitingStatus": 0,
            "treatmentEndStatus": -1,
            "doctorId": null,
            "doctorName": null,
            "callingTime": null,
            "isReferral": 0
        },
        {
            "id": "b72a386bcf8146ada1e0df8939fe2d15",
            "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
            "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
            "queuingOrderNo": 103,
            "patientKey": "999999999002",
            "patientName": "多大的2",
            "registerId": "2",
            "registerTime": "20180523095615",
            "timeType": 0,
            "triageTime": "20180523095621",
            "queuingDate": "20180523000000",
            "delayTime": 0,
            "delayEditTime": null,
            "editor": "automatic",
            "editTime": "20180523095621",
            "isDeleted": 0,
            "sex": 1,
            "signOrderNo": 103,
            "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
            "remarks": null,
            "isNumRecall": 0,
            "isGreenChannel": 0,
            "treatStatus": 1,
            "treatmentStage": 1,
            "waitingStatus": 0,
            "treatmentEndStatus": -1,
            "doctorId": null,
            "doctorName": null,
            "callingTime": null,
            "isReferral": 0
        },
        {
            "id": "1c15199a88e749ecab28e735c1825518",
            "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
            "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
            "queuingOrderNo": 104,
            "patientKey": "999999999003",
            "patientName": "多大的3",
            "registerId": "3",
            "registerTime": "20180523095706",
            "timeType": 0,
            "triageTime": "20180523095720",
            "queuingDate": "20180523000000",
            "delayTime": 0,
            "delayEditTime": null,
            "editor": "automatic",
            "editTime": "20180523095720",
            "isDeleted": 0,
            "sex": 1,
            "signOrderNo": 104,
            "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
            "remarks": null,
            "isNumRecall": 0,
            "isGreenChannel": 0,
            "treatStatus": 1,
            "treatmentStage": 1,
            "waitingStatus": 0,
            "treatmentEndStatus": -1,
            "doctorId": null,
            "doctorName": null,
            "callingTime": null,
            "isReferral": 0
        },
        {
            "id": "56997af6970f4c329461ce26f8cd793c",
            "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
            "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
            "queuingOrderNo": 105,
            "patientKey": "999999999004",
            "patientName": "多大的4",
            "registerId": "4",
            "registerTime": "20180523095711",
            "timeType": 0,
            "triageTime": "20180523095721",
            "queuingDate": "20180523000000",
            "delayTime": 0,
            "delayEditTime": null,
            "editor": "automatic",
            "editTime": "20180523095721",
            "isDeleted": 0,
            "sex": 1,
            "signOrderNo": 105,
            "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
            "remarks": null,
            "isNumRecall": 0,
            "isGreenChannel": 0,
            "treatStatus": 1,
            "treatmentStage": 1,
            "waitingStatus": 0,
            "treatmentEndStatus": -1,
            "doctorId": null,
            "doctorName": null,
            "callingTime": null,
            "isReferral": 0
        },
        {
            "id": "d4c18c9e3c9542d0931cdb804523ccec",
            "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
            "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
            "queuingOrderNo": 106,
            "patientKey": "999999999005",
            "patientName": "多大的5",
            "registerId": "5",
            "registerTime": "20180523095714",
            "timeType": 0,
            "triageTime": "20180523095721",
            "queuingDate": "20180523000000",
            "delayTime": 0,
            "delayEditTime": null,
            "editor": "automatic",
            "editTime": "20180523095721",
            "isDeleted": 0,
            "sex": 1,
            "signOrderNo": 106,
            "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
            "remarks": null,
            "isNumRecall": 0,
            "isGreenChannel": 0,
            "treatStatus": 1,
            "treatmentStage": 1,
            "waitingStatus": 0,
            "treatmentEndStatus": -1,
            "doctorId": null,
            "doctorName": "多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5",
            "callingTime": null,
            "isReferral": 0
        },
        {
            "id": "70e573d556b6413da4f90e3e0deb555d",
            "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
            "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
            "queuingOrderNo": 107,
            "patientKey": "999999999006",
            "patientName": "多大的6",
            "registerId": "6",
            "registerTime": "20180523095718",
            "timeType": 0,
            "triageTime": "20180523095722",
            "queuingDate": "20180523000000",
            "delayTime": 0,
            "delayEditTime": null,
            "editor": "automatic",
            "editTime": "20180523095722",
            "isDeleted": 0,
            "sex": 1,
            "signOrderNo": 107,
            "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
            "remarks": null,
            "isNumRecall": 0,
            "isGreenChannel": 0,
            "treatStatus": 1,
            "treatmentStage": 1,
            "waitingStatus": 0,
            "treatmentEndStatus": -1,
            "doctorId": null,
            "doctorName": null,
            "callingTime": null,
            "isReferral": 0
        },
        {
            "id": "2ad4a189701141c7bb20dd39ccef648b",
            "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
            "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
            "queuingOrderNo": 108,
            "patientKey": "999999999007",
            "patientName": "多大的7",
            "registerId": "7",
            "registerTime": "20180523095722",
            "timeType": 0,
            "triageTime": "20180523095740",
            "queuingDate": "20180523000000",
            "delayTime": 0,
            "delayEditTime": null,
            "editor": "automatic",
            "editTime": "20180523095740",
            "isDeleted": 0,
            "sex": 1,
            "signOrderNo": 108,
            "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
            "remarks": null,
            "isNumRecall": 0,
            "isGreenChannel": 0,
            "treatStatus": 1,
            "treatmentStage": 1,
            "waitingStatus": 0,
            "treatmentEndStatus": -1,
            "doctorId": null,
            "doctorName": null,
            "callingTime": null,
            "isReferral": 0
        },
        {
            "id": "7bf323f505ea421b8076429368ba0184",
            "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
            "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
            "queuingOrderNo": 109,
            "patientKey": "999999999008",
            "patientName": "多大的8",
            "registerId": "8",
            "registerTime": "20180523095726",
            "timeType": 0,
            "triageTime": "20180523095741",
            "queuingDate": "20180523000000",
            "delayTime": 0,
            "delayEditTime": null,
            "editor": "automatic",
            "editTime": "20180523095741",
            "isDeleted": 0,
            "sex": 1,
            "signOrderNo": 109,
            "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
            "remarks": null,
            "isNumRecall": 0,
            "isGreenChannel": 0,
            "treatStatus": 1,
            "treatmentStage": 1,
            "waitingStatus": 0,
            "treatmentEndStatus": -1,
            "doctorId": null,
            "doctorName": null,
            "callingTime": null,
            "isReferral": 0
        },
        {
            "id": "c8e59934322d40cd8554ac12e9660ed6",
            "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
            "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
            "queuingOrderNo": 110,
            "patientKey": "999999999009",
            "patientName": "多大的9",
            "registerId": "9",
            "registerTime": "20180523095730",
            "timeType": 0,
            "triageTime": "20180523095742",
            "queuingDate": "20180523000000",
            "delayTime": 0,
            "delayEditTime": null,
            "editor": "automatic",
            "editTime": "20180523095742",
            "isDeleted": 0,
            "sex": 1,
            "signOrderNo": 110,
            "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
            "remarks": null,
            "isNumRecall": 0,
            "isGreenChannel": 0,
            "treatStatus": 1,
            "treatmentStage": 1,
            "waitingStatus": 0,
            "treatmentEndStatus": -1,
            "doctorId": null,
            "doctorName": null,
            "callingTime": null,
            "isReferral": 0
        },
        {
            "id": "132cdf7fadeb4b5396c2f969cbc5608e",
            "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
            "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
            "queuingOrderNo": 111,
            "patientKey": "999999999010",
            "patientName": "多大的10",
            "registerId": "10",
            "registerTime": "20180523095754",
            "timeType": 0,
            "triageTime": "20180523095800",
            "queuingDate": "20180523000000",
            "delayTime": 0,
            "delayEditTime": null,
            "editor": "automatic",
            "editTime": "20180523095800",
            "isDeleted": 0,
            "sex": 1,
            "signOrderNo": 111,
            "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
            "remarks": "多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5多大的5",
            "isNumRecall": 0,
            "isGreenChannel": 0,
            "treatStatus": 1,
            "treatmentStage": 1,
            "waitingStatus": 0,
            "treatmentEndStatus": -1,
            "doctorId": null,
            "doctorName": null,
            "callingTime": null,
            "isReferral": 0
        },
         {
             "id": "132cdf7fadeb4b5396c2f969cbc5608e11",
             "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
             "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
             "queuingOrderNo": 111,
             "patientKey": "999999999011",
             "patientName": "多大的11",
             "registerId": "11",
             "registerTime": "20180523095754",
             "timeType": 0,
             "triageTime": "20180523095800",
             "queuingDate": "20180523000000",
             "delayTime": 0,
             "delayEditTime": null,
             "editor": "automatic",
             "editTime": "20180523095800",
             "isDeleted": 0,
             "sex": 1,
             "signOrderNo": 111,
             "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
             "remarks": null,
             "isNumRecall": 0,
             "isGreenChannel": 0,
             "treatStatus": 1,
             "treatmentStage": 1,
             "waitingStatus": 0,
             "treatmentEndStatus": -1,
             "doctorId": null,
             "doctorName": null,
             "callingTime": null,
             "isReferral": 0
         }, {
             "id": "132cdf7fadeb4b5396c2f969cbc5608e11",
             "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
             "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
             "queuingOrderNo": 111,
             "patientKey": "999999999011",
             "patientName": "多大的11",
             "registerId": "11",
             "registerTime": "20180523095754",
             "timeType": 0,
             "triageTime": "20180523095800",
             "queuingDate": "20180523000000",
             "delayTime": 0,
             "delayEditTime": null,
             "editor": "automatic",
             "editTime": "20180523095800",
             "isDeleted": 0,
             "sex": 1,
             "signOrderNo": 111,
             "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
             "remarks": null,
             "isNumRecall": 0,
             "isGreenChannel": 0,
             "treatStatus": 1,
             "treatmentStage": 1,
             "waitingStatus": 0,
             "treatmentEndStatus": -1,
             "doctorId": null,
             "doctorName": null,
             "callingTime": null,
             "isReferral": 0
         }, {
             "id": "132cdf7fadeb4b5396c2f969cbc5608e11",
             "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
             "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
             "queuingOrderNo": 111,
             "patientKey": "999999999011",
             "patientName": "多大的11",
             "registerId": "11",
             "registerTime": "20180523095754",
             "timeType": 0,
             "triageTime": "20180523095800",
             "queuingDate": "20180523000000",
             "delayTime": 0,
             "delayEditTime": null,
             "editor": "automatic",
             "editTime": "20180523095800",
             "isDeleted": 0,
             "sex": 1,
             "signOrderNo": 111,
             "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
             "remarks": null,
             "isNumRecall": 0,
             "isGreenChannel": 0,
             "treatStatus": 1,
             "treatmentStage": 1,
             "waitingStatus": 0,
             "treatmentEndStatus": -1,
             "doctorId": null,
             "doctorName": null,
             "callingTime": null,
             "isReferral": 0
         }, {
             "id": "132cdf7fadeb4b5396c2f969cbc5608e11",
             "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
             "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
             "queuingOrderNo": 111,
             "patientKey": "999999999011",
             "patientName": "多大的11",
             "registerId": "11",
             "registerTime": "20180523095754",
             "timeType": 0,
             "triageTime": "20180523095800",
             "queuingDate": "20180523000000",
             "delayTime": 0,
             "delayEditTime": null,
             "editor": "automatic",
             "editTime": "20180523095800",
             "isDeleted": 0,
             "sex": 1,
             "signOrderNo": 111,
             "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
             "remarks": null,
             "isNumRecall": 0,
             "isGreenChannel": 0,
             "treatStatus": 1,
             "treatmentStage": 1,
             "waitingStatus": 0,
             "treatmentEndStatus": -1,
             "doctorId": null,
             "doctorName": null,
             "callingTime": null,
             "isReferral": 0
         }, {
             "id": "132cdf7fadeb4b5396c2f969cbc5608e11",
             "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
             "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
             "queuingOrderNo": 111,
             "patientKey": "999999999011",
             "patientName": "多大的11",
             "registerId": "11",
             "registerTime": "20180523095754",
             "timeType": 0,
             "triageTime": "20180523095800",
             "queuingDate": "20180523000000",
             "delayTime": 0,
             "delayEditTime": null,
             "editor": "automatic",
             "editTime": "20180523095800",
             "isDeleted": 0,
             "sex": 1,
             "signOrderNo": 111,
             "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
             "remarks": null,
             "isNumRecall": 0,
             "isGreenChannel": 0,
             "treatStatus": 1,
             "treatmentStage": 1,
             "waitingStatus": 0,
             "treatmentEndStatus": -1,
             "doctorId": null,
             "doctorName": null,
             "callingTime": null,
             "isReferral": 0
         }, {
             "id": "132cdf7fadeb4b5396c2f969cbc5608e11",
             "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
             "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
             "queuingOrderNo": 111,
             "patientKey": "999999999011",
             "patientName": "多大的11",
             "registerId": "11",
             "registerTime": "20180523095754",
             "timeType": 0,
             "triageTime": "20180523095800",
             "queuingDate": "20180523000000",
             "delayTime": 0,
             "delayEditTime": null,
             "editor": "automatic",
             "editTime": "20180523095800",
             "isDeleted": 0,
             "sex": 1,
             "signOrderNo": 111,
             "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
             "remarks": null,
             "isNumRecall": 0,
             "isGreenChannel": 0,
             "treatStatus": 1,
             "treatmentStage": 1,
             "waitingStatus": 0,
             "treatmentEndStatus": -1,
             "doctorId": null,
             "doctorName": null,
             "callingTime": null,
             "isReferral": 0
         }, {
             "id": "132cdf7fadeb4b5396c2f969cbc5608e11",
             "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
             "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
             "queuingOrderNo": 111,
             "patientKey": "999999999011",
             "patientName": "多大的11",
             "registerId": "11",
             "registerTime": "20180523095754",
             "timeType": 0,
             "triageTime": "20180523095800",
             "queuingDate": "20180523000000",
             "delayTime": 0,
             "delayEditTime": null,
             "editor": "automatic",
             "editTime": "20180523095800",
             "isDeleted": 0,
             "sex": 1,
             "signOrderNo": 111,
             "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
             "remarks": null,
             "isNumRecall": 0,
             "isGreenChannel": 0,
             "treatStatus": 1,
             "treatmentStage": 1,
             "waitingStatus": 0,
             "treatmentEndStatus": -1,
             "doctorId": null,
             "doctorName": null,
             "callingTime": null,
             "isReferral": 0
         }, {
             "id": "132cdf7fadeb4b5396c2f969cbc5608e11",
             "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
             "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
             "queuingOrderNo": 111,
             "patientKey": "999999999011",
             "patientName": "多大的11",
             "registerId": "11",
             "registerTime": "20180523095754",
             "timeType": 0,
             "triageTime": "20180523095800",
             "queuingDate": "20180523000000",
             "delayTime": 0,
             "delayEditTime": null,
             "editor": "automatic",
             "editTime": "20180523095800",
             "isDeleted": 0,
             "sex": 1,
             "signOrderNo": 111,
             "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
             "remarks": null,
             "isNumRecall": 0,
             "isGreenChannel": 0,
             "treatStatus": 1,
             "treatmentStage": 1,
             "waitingStatus": 0,
             "treatmentEndStatus": -1,
             "doctorId": null,
             "doctorName": null,
             "callingTime": null,
             "isReferral": 0
         }, {
             "id": "132cdf7fadeb4b5396c2f969cbc5608e11",
             "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
             "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
             "queuingOrderNo": 111,
             "patientKey": "999999999011",
             "patientName": "多大的11",
             "registerId": "11",
             "registerTime": "20180523095754",
             "timeType": 0,
             "triageTime": "20180523095800",
             "queuingDate": "20180523000000",
             "delayTime": 0,
             "delayEditTime": null,
             "editor": "automatic",
             "editTime": "20180523095800",
             "isDeleted": 0,
             "sex": 1,
             "signOrderNo": 111,
             "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
             "remarks": null,
             "isNumRecall": 0,
             "isGreenChannel": 0,
             "treatStatus": 1,
             "treatmentStage": 1,
             "waitingStatus": 0,
             "treatmentEndStatus": -1,
             "doctorId": null,
             "doctorName": null,
             "callingTime": null,
             "isReferral": 0
         }, {
             "id": "132cdf7fadeb4b5396c2f969cbc5608e11",
             "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
             "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
             "queuingOrderNo": 111,
             "patientKey": "999999999011",
             "patientName": "多大的11",
             "registerId": "11",
             "registerTime": "20180523095754",
             "timeType": 0,
             "triageTime": "20180523095800",
             "queuingDate": "20180523000000",
             "delayTime": 0,
             "delayEditTime": null,
             "editor": "automatic",
             "editTime": "20180523095800",
             "isDeleted": 0,
             "sex": 1,
             "signOrderNo": 111,
             "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
             "remarks": null,
             "isNumRecall": 0,
             "isGreenChannel": 0,
             "treatStatus": 1,
             "treatmentStage": 1,
             "waitingStatus": 0,
             "treatmentEndStatus": -1,
             "doctorId": null,
             "doctorName": null,
             "callingTime": null,
             "isReferral": 0
         }, {
             "id": "132cdf7fadeb4b5396c2f969cbc5608e11",
             "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
             "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
             "queuingOrderNo": 111,
             "patientKey": "999999999011",
             "patientName": "多大的11",
             "registerId": "11",
             "registerTime": "20180523095754",
             "timeType": 0,
             "triageTime": "20180523095800",
             "queuingDate": "20180523000000",
             "delayTime": 0,
             "delayEditTime": null,
             "editor": "automatic",
             "editTime": "20180523095800",
             "isDeleted": 0,
             "sex": 1,
             "signOrderNo": 111,
             "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
             "remarks": null,
             "isNumRecall": 0,
             "isGreenChannel": 0,
             "treatStatus": 1,
             "treatmentStage": 1,
             "waitingStatus": 0,
             "treatmentEndStatus": -1,
             "doctorId": null,
             "doctorName": null,
             "callingTime": null,
             "isReferral": 0
         }, {
             "id": "132cdf7fadeb4b5396c2f969cbc5608e11",
             "queueId": "68ba2e7819b040da871bbdc0a3c92c9d",
             "queuingKey": "1366f1f07da04346becdf6a898e97dc6",
             "queuingOrderNo": 111,
             "patientKey": "999999999011",
             "patientName": "多大的11",
             "registerId": "11",
             "registerTime": "20180523095754",
             "timeType": 0,
             "triageTime": "20180523095800",
             "queuingDate": "20180523000000",
             "delayTime": 0,
             "delayEditTime": null,
             "editor": "automatic",
             "editTime": "20180523095800",
             "isDeleted": 0,
             "sex": 1,
             "signOrderNo": 111,
             "hospitalId": "4e66fabafd944e458dc259ce890c31f3",
             "remarks": null,
             "isNumRecall": 0,
             "isGreenChannel": 0,
             "treatStatus": 1,
             "treatmentStage": 1,
             "waitingStatus": 0,
             "treatmentEndStatus": -1,
             "doctorId": null,
             "doctorName": null,
             "callingTime": null,
             "isReferral": 0
         }
];



var dataGrid_hz,
    orderType_hz = '',
    orderField_hz = '',
    PAGESIZE_hz,
    pageCount_hz,
    rsCount_hz;

var hz_datagridflg = false;


// 请求数据
function requestHzData(queueId) {
    localStorage.setItem("_ISNOSPLIT_PAGE_", "N");
    $.ajax({
        url: _hzGetPatients,
        type: "get",
        data: {
            queueId: queueId,
            resource: 'STS'
        },
        beforSend: function () {
            layer.msg("正在加载数据", { icon: 16 });
        },
        success: function (data) {

            //alert(mLoadFlg);
            layer.close(mLoadFlg);

            var result = JSON.parse(data);
            if (result.status == 0) {
                loadHzDataGrid(result.data);
            } else {
                loadDataFailed(result.desc, 11);
            }
        },
        error: function (jqXHR, textStatus, errorThrown) {
            console.log(textStatus);
            console.log(errorThrown);
            loadDataFailed("获取候诊列表数据失败!", 11);
        }
    });
    //loadHzDataGrid(_jsonData_hz);
}

//构建侯诊表格结构
function loadHzDataGrid(d /* String */) {

    //测试放开
    //d = _jsonData_hz;
    // console.log(d);

    var totalNum = 0;
    var _html = "";
    //var _queryKey = "2ad4a189701141c7bb20dd39c11cef648b";//localStorage.getItem("_P_KEY_") == null ? "" : localStorage.getItem("_P_KEY_");
    var _queryKey = localStorage.getItem("_P_KEY_") == null ? "" : localStorage.getItem("_P_KEY_");
    var _initSelected = false;

    if (d !== null) {
        var count = 0;
        totalNum = d.length;
        for (var i = 0; i < d.length; i++) {
            var _id = d[i].id;
            var _fznumber = getNotBlankData(d[i].registerId);
            var _hzname = getNotBlankData(d[i].patientName);
            var _doctorname = getNotBlankData(d[i].doctorName);//普通队列医生名字
            var _docName = getNotBlankData(d[i].docName);//专家队列医生名字
            var _treate_status = getNotBlankData(getTreatStatus(d[i].treatStatus));
            var _waitstatus = getNotBlankData(getWaitingStatus(d[i].waitingStatus));
            var _treate_stage_status = getNotBlankData(getTreatmentStatus(d[i].treatmentStage));
            var _treate_end_status = getNotBlankData(getEndStatus(d[i].treatmentEndStatus));
            var _recall_status = getNotBlankData(getRecallStatus(d[i].isNumRecall));
            var _green_status = getNotBlankData(getGreenStatus(d[i].isGreenChannel));
            var _ys_edit_time = getNotBlankData(d[i].delayEditTime);
            var _ys = getNotBlankData(d[i].delayTime);
            var _wb = getTimeName(d[i].timeType);
            var _ghtm = getNotBlankData(d[i].registerTime);
            var _jhtm = getNotBlankData(d[i].callingTime);
            var _remark = getNotBlankData(d[i].remarks);
            var _queueId = getNotBlankData(d[i].queueId);
            var pretestStage = getNotBlankData(d[i].pretestStage);
            var hznameStyle = "background: #FFFFFF"
            if (showColorButtons()) {
                if (pretestStage == "1") {
                    hznameStyle = "background: #fe0000";
                } else if (pretestStage == "2") {
                    hznameStyle = "background: #fffa08";
                } else if (pretestStage == "3") {
                    hznameStyle = "background: #33cc00";
                }
            }
            //普通队列不是指定医生/专家队列，不显示删除按钮，普通队列复诊指定医生后显示删除按钮
            var doctorname = "";
            var delDoctorStyle = "display: none";
            if (_docName !== "") {
                doctorname = _docName;
                delDoctorStyle = "display: none";
            } else {
                if (_doctorname == "" || _doctorname == "全部") {
                    doctorname = "";
                    delDoctorStyle = "display: none";
                } else {
                    doctorname = _doctorname;
                    delDoctorStyle = "display: block";
                }
            }

            count++;

            var _inputRadio = "";
            if (_queryKey == _id) {


                localStorage.setItem("_P_KEY_", "");
                _initSelected = true;
                _inputRadio = "<input type='radio' checked='checked' name='sel_radio' id='" + _id + "' name='hz_" + _fznumber + "' onclick='select_hz_row(this);' " +
                    "data-treate_status='" + d[i].treatStatus + "' data-wait_status='" + d[i].waitingStatus + "' " +
                    "data-treate_stage_status='" + d[i].treatmentStage + "' data-treate_end_status='" + d[i].treatmentEndStatus + "' " +
                    "data-recall_status='" + d[i].isNumRecall + "' data-green_status='" + d[i].isGreenChannel + "' data-color_status='" + d[i].pretestStage + "' data-signId='" + d[i].creater + "'/>";

            } else {
                _inputRadio = "<input type='radio' name='sel_radio' id='" + _id + "' name='hz_" + _fznumber + "' onclick='select_hz_row(this);' " +
              "data-treate_status='" + d[i].treatStatus + "' data-wait_status='" + d[i].waitingStatus + "' " +
              "data-treate_stage_status='" + d[i].treatmentStage + "' data-treate_end_status='" + d[i].treatmentEndStatus + "' " +
              "data-recall_status='" + d[i].isNumRecall + "' data-green_status='" + d[i].isGreenChannel + "' data-color_status='" + d[i].pretestStage + "' data-signId='" + d[i].creater + "'/>";
            }


            _html += "<tr>";
            _html += "<td><span >" + _inputRadio + "</span></td>";
            _html += "<td><span style='color:#6DA4EA;'>" + count + "</span></td>";
            _html += "<td class='number'><span>" + _fznumber + "</span></td>";
            _html += "<td><span style='" + hznameStyle + "'>" + _hzname + "</span></td>";
            _html += "<td><span class='doctorname' id=' fz" + _id + "'>" + doctorname + " <button style='" + delDoctorStyle + "' class='delDoctorBtn' type='button' onclick='delDoctorName(this,\"" + _id + "\",\"" + _queueId + "\")'></button></span></td>";
            _html += "<td><span>" + _treate_status + "</span></td>";
            _html += "<td><span>" + _waitstatus + "</span></td>";
            _html += "<td><span>" + _treate_stage_status + "</span></td>";
            /*_html += "<td><span>" + _treate_end_status + "</span></td>";*/
            _html += "<td><span>" + _recall_status + "</span></td>";
            /*_html += "<td><span>" + _green_status + "</span></td>";*/
            _html += "<td><span>" + getDelayDetailTime(_ys_edit_time, _ys) + "</span></td>";
            _html += "<td><span>" + _wb + "</span></td>";
            _html += "<td><span>" + _ghtm + "</span></td>";
            _html += "<td><span>" + _jhtm + "</span></td>";
            _html += "<td  title='" + _remark + "'><a data-id='" + _id + "' data-remark='" + _remark + "' onclick='set_hz_remark(this);'><span style='text-overflow: ellipsis; white-space: nowrap; overflow: hidden;'>" + _remark + "</span></a></td>";

            _html += "</tr>";
        }
    }

    //填充表内容
    $("#t_table_hz_content").html(_html);
    //显示表条数
    //$("#table_hz_d_count").html(d!==null ? d.length : 0);
    //表头排序
    $('#t_table_hz').tablesort().data('tablesort');
    $('thead th.number').data('sortBy', function (th, td, sorter) {
        return parseInt(td.text(), 10);
    });


    //更新页面脚标
    $('#patientNum').html("当前队列共" + totalNum + "位患者");
    //是否有搜索，需要初始化选中效果


    if (_initSelected) {
        var _t = $("#" + _queryKey);
        select_hz_row(_t, _initSelected);
    }

}

//删除普通队列复诊指定的医生
function delDoctorName(_this, id, queueId) {
    var hospitalId = getHospitalId();
    var loginId = getLoginUserId();
    layer.confirm("确认将为此患者取消接诊医生的绑定吗？", {
        closeBtn: 0,
        btn: ['确定', '取消'],
        icon: 7
    }, function (index) {
        $.ajax({
            url: _delDoctorUrl,
            type: "post",
            data: {
                hospitalId: hospitalId,
                id: id,
                loginId: loginId,
                queueId: queueId
            },
            beforSend: function () {
                layer.msg("正在加载数据", { icon: 16 });
            },
            success: function (data) {
                layer.closeAll();
                var result = JSON.parse(data);
                if (result.status == 0) {
                    requestHzData(queueId);
                    layer.alert("操作成功!", { icon: 1, time: 2000 });
                    // $(_this).parent().html("");
                }
            },
            error: function (jqXHR, textStatus, errorThrown) {
                layer.alert("操作失败", { icon: 2 });
            }
        });
    }, function () {
        layer.closeAll();
    });
}
//选择一行
function select_hz_row(t, isSearch) {

    console.log($(t).prop("checked"));
    var _ischeked = $(t).prop("checked");

    $("#t_table_hz_content tr").each(function () {
        //console.log($(this).children("td:last"));
        $(this).children("td:last").find("span").css({
            "border-right": "1px solid #FFFFFF",
            //            "background-color": "#F2F3F3"
        });
    });


    //设置本行变色
    if (_ischeked || isSearch) {
        $(t).parent().parent().find("span").css({
            "border-top": "1px solid #3598db",
            "border-bottom": "1px solid #3598db",
            "border-left": "1px solid #3598db",
            //           "background-color": "#F2F3F3"
        });

        $(t).parent().parent().nextAll().each(function () {
            $(this).find("span").css({
                "border-top": "1px solid #3598db",
                "border-bottom": "1px solid #3598db",
                //               "background-color": "#F2F3F3"
            });
        });

        $(t).parent().parent().parent().prevAll().each(function () {
            $(this).find("span").css({
                "border-top": "",
                "border-bottom": "",
                "border-left": "",
                //               "background-color": "#FFFFFF"
            });
        });

        $(t).parent().parent().parent().nextAll().each(function () {
            $(this).find("span").css({
                "border-top": "",
                "border-bottom": "",
                "border-left": "",
                //               "background-color": "#FFFFFF"
            });
        });

        $(t).parent().parent().nextAll().last().find("span").css({
            "border-right": "1px solid #3598db",
            //            "background-color": "#F2F3F3"
        });
    }

    setButtonStatus(t);
}

// 对指定患者设置备注
function set_hz_remark(_this) {
    var id = $(_this).attr("data-id");
    var remark = $(_this).attr("data-remark");

    var win_name = "remarkWin";
    layer.open({
        id: win_name,
        type: 2,
        title: false,
        shadeClose: false,
        closeBtn: 0,
        area: ['400px', '200px'],
        content: '../window/remark_win.html?id=' + id + "&remark=" + remark,
        btn: ['确定', '取消'],
        yes: function (index, layero) {
            var frameId = document.getElementById(win_name).getElementsByTagName('iframe')[0].id;
            var result = $('#' + frameId)[0].contentWindow.updateRemark();
            console.log(result);
            if (result != false) {
                parent.layer.close(index);
                refreshTab();
            }
        },
        cancel: function () {

        }
    });
}




